package com.hp.ssm.service.impl;

import com.github.pagehelper.PageHelper;
import com.hp.ssm.entity.Doctor;
import com.hp.ssm.entity.Hospital;
import com.hp.ssm.mapper.DoctroMapper;
import com.hp.ssm.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DoctorServiceImpl implements DoctorService {
    @Autowired
    public DoctroMapper doctroMapper;

    @Override
    public List<Doctor> showAll2(Doctor doctor, Integer page,Integer limit) {
        PageHelper.startPage(page, limit);
        return doctroMapper.showAll2(doctor);
    }

    @Override
    public Doctor findId(int did) {
        return doctroMapper.findId(did);
    }

    @Override
    public int updateStatus(Doctor doctor) {
        return doctroMapper.updateStatus(doctor);
    }
    
    @Override
    public int insert(Doctor doctor) {
        return doctroMapper.insert(doctor);
    }

    @Override
    public List<Doctor> showAll(Doctor doctor, Integer page,Integer limit) {
       if(page != null && limit != null) {
           PageHelper.startPage(page, limit);
       }
        return doctroMapper.showAll(doctor);
    }


    @Override
    public int del(Doctor doctor) {
        return doctroMapper.del(doctor);
    }

    @Override
    public int reck(Doctor doctor) {
        return doctroMapper.reck(doctor);
    }
}
